package com.axjy.service.impl;

import com.axjy.mapper.UserMapper;
import com.axjy.pojo.User;
import com.axjy.service.UserService;
import com.axjy.vo.Pager;
import com.axjy.vo.UserDto;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("userService")
public class UserServiceImpl implements UserService{
    @Resource
    private UserMapper userMapper;
    @Override
    public Pager searchPager(UserDto dto) {
        List<User> list=userMapper.findAll(dto);
        Pager pager=new Pager(list);
        return pager;
    }

    @Override
    public void grant(Integer uid, Integer rid) {
        userMapper.updateRole(uid,rid);
    }

    @Override
    public User login(String name, String pwd) {
        User user=userMapper.findUser(name,pwd);
        return user;
    }
}
